﻿using System.Security.Principal;
using Super.Common.Model.Security;

namespace Super.Common.Security
{
    public class IdentityProvider : IIdentity
    {
        public static IdentityProvider Current
        {
            get
            {
                return System.Threading.Thread.CurrentPrincipal.Identity as IdentityProvider;
            }
        }

        public UserDTO User { get; set; }

        public IdentityProvider(UserDTO user)
        {
            this.User = user;
        }

        public string AuthenticationType
        {
            get;
            set;
        }

        public bool IsAuthenticated
        {
            get
            {
                return true;
            }
        }

        public string Name
        {
            get { return User.UserName; }
        }
    }
}